package com.nes.fiber.controller;

import co.paralleluniverse.fibers.SuspendExecution;
import com.nes.fiber.service.FiberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by wdq on 17-4-6.
 */
@RestController
@RequestMapping("/fiber")
public class FiberController {

    @Autowired
    private FiberService fiberService;

    @RequestMapping("/num")
    public Integer getNum() {
        try {
            return fiberService.getNumberCount(10);
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (SuspendExecution execution) {
            throw new AssertionError(execution);
        }
        return 0;
    }

}
